package pl.moominek.ekosegragator;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

public class ListaZIkonka extends BaseAdapter {

    private ZawartoscListyZIkonka[] data;
    private Context ctx;
 
    public ListaZIkonka(Context ctx, ZawartoscListyZIkonka[] importeddata) {
    	this.ctx = ctx;
    	this.data = importeddata;
    }
 
    public int getCount() {
    return data.length;
    }
	 
	public Object getItem(int position) {
	    return null;
	}
	 
	public long getItemId(int position) {
	    return 0;
	}
	 
	public View getView(int position, View convertView, ViewGroup parent) {	 
		
		 if (convertView == null) {
			 LayoutInflater inflater = (LayoutInflater) ctx.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
			 convertView = inflater.inflate(R.layout.wyglad_listy_z_ikonka, parent, false);
		 }
		 
		    TextView tekst_w_layoucie = (TextView) convertView.findViewById(R.id.textView_w_liscie_z_ikonka);
		    ImageView imageView = (ImageView) convertView.findViewById(R.id.imageView_w_liscie_z_ikonka);
		    imageView.setImageResource(data[position].get_obraz());
		    tekst_w_layoucie.setText(data[position].get_opis());

	    return convertView;
	}
}
